import 'dart:io';

import 'package:daoyi_ui_admin_getx/app/common/utils/common_toast_util.dart';
import 'package:daoyi_ui_admin_getx/app/routes/app_pages.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/common_develop_lang_widget.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/common_floating_action_button_widget.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/common_image_pick_widget.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/form/common_form_item_widget.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/form/common_title_widget.dart';
import 'package:daoyi_ui_admin_getx/generated/locales.g.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'resume_publish_controller.dart';

class ResumePublishView extends GetView<ResumePublishController> {
  const ResumePublishView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('发布简历'),
        centerTitle: true,
      ),
      floatingActionButton: CommonFloatingActionButtonWidget(
        "提交",
        () {
          CommonToastUtil.showToast(LocaleKeys.actions_success.tr);
        },
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
      body: SafeArea(
        child: ListView(
          children: [
            const CommonTitleWidget("个人信息"),
            const CommonFormItemWidget(
              label: "姓名",
              hintText: "请填写真实姓名，用于投递简历",
            ),
            Obx(
              () => CommonFormItemWidget.radio(
                label: "性别",
                options: const ["男", "女"],
                value: controller.sex.value,
                onChanged: (value) {
                  controller.setSex(value);
                },
              ),
            ),
            Obx(
              () => CommonFormItemWidget.radio(
                label: "当前身份",
                options: const ["职场人", "学生"],
                value: controller.currentIdentity.value,
                onChanged: (value) {
                  controller.setCurrentIdentity(value);
                },
              ),
            ),
            const CommonFormItemWidget(
              label: "出生年月",
            ),
            const CommonFormItemWidget(
              label: "参加工作时间",
            ),
            const CommonFormItemWidget(
              label: "户口所在地",
            ),
            const CommonFormItemWidget(
              label: "现居住城市",
            ),
            Obx(
              () => CommonFormItemWidget.select(
                label: "政治面貌",
                hintText: "请选择政治面貌",
                options: const [
                  "中共党员（含预备党员）",
                  "民主党派",
                  "无党派人士",
                  "团员",
                  "群众",
                ],
                value: controller.politicalStatus.value,
                onChanged: (value) {
                  controller.setPoliticalStatus(value);
                },
              ),
            ),
            const CommonFormItemWidget(
              label: "婚姻状况",
            ),
            const CommonFormItemWidget(
              label: "联系方式",
            ),
            const CommonFormItemWidget(
              label: "电子邮箱",
            ),
            const CommonTitleWidget("风采图册"),
            CommonImagePickWidget(
              onChange: (List<File> files) {
                print(files);
              },
            ),
            const CommonTitleWidget("求职状态"),
            const CommonTitleWidget("求职意向"),
            const CommonTitleWidget("工作/实习经历"),
            CommonFormItemWidget.selectPage(
              label: "公司名称",
              hintText: "请输入公司名称",
              page: Routes.COMPANY_SEARCH,
            ),
            CommonFormItemWidget(
              label: "公司规模",
              hintText: "请输入公司规模",
              suffixText: '人',
              controller: TextEditingController(),
            ),
            CommonFormItemWidget(
              label: "当前月薪",
              hintText: "请输入当前月薪(选填)",
              suffixText: '元',
              controller: TextEditingController(),
            ),
            const CommonTitleWidget("教育经历"),
            const CommonTitleWidget("项目经历"),
            const CommonTitleWidget("培训经历"),
            const CommonTitleWidget("开发语言"),
            CommonDevelopLangWidget(
              onChanged: (List<CommonDevelopLanData> value) {
                print(value);
              },
            ),
            const CommonTitleWidget("语言能力"),
            const CommonTitleWidget("专业技能"),
            const CommonTitleWidget("证书"),
            const CommonTitleWidget("个人作品"),
            const CommonTitleWidget("个人优势"),
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 10),
              child: TextField(
                controller: controller.advantagesController,
                maxLines: 10,
                decoration: const InputDecoration(
                  border: InputBorder.none,
                  hintText:
                      "建议您对自己做一个简短评价，简明扼要地描述您的职业优势，让用人单位快速地了解您！优秀的自我评价可以吸引招聘人员的眼球，为您的简历增色不少！为保护个人隐私，请不要填写手机号、QQ、微信等联系方式",
                ),
              ),
            ),
            const SizedBox(
              height: 100,
            ),
          ],
        ),
      ),
    );
  }
}
